<template>
  <div class="home">
    <div class="list">
      <good v-for="item in list" :key="item._id" :item="item"></good>
    </div>
  </div>
</template>

<script>
import good from "../components/Good.vue";
export default {
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.$axios.get("list.json").then((res) => {
      console.log(res);
      this.list = res.data.result;
    });
    //注意：如果是public里的json数据 那么路径就是相对于index.html的路径
    //注意：拿到数据一定要打印，才能知道是xx.xx
  },
  components: {
    good,
  },
};
</script>
<style lang="scss">
.list {
  display: flex;
  flex-wrap: wrap;
  > div {
    width: 50%;
    text-align: center;
    border: 1px solid #ccc;
    box-sizing: border-box;
    padding-top: 20px;
    margin-top: 20px;
    img {
      width: 80%;
    }
  }
}
</style>
